﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace CCWpf.Utils
{
    public static class WindowExt
    {
        /// <summary>
        /// 注册窗口/页面方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="win">要注册其他窗口/页的窗口对象</param>
        /// <param name="key">被注册窗口的key</param>
        public static void Register<T>(this Window win, string key)
        {
            WindowManager.Register<T>(key);
        }
        /// <summary>
        /// 注册窗口/页面方法
        /// </summary>
        /// <param name="win"></param>
        /// <param name="key"></param>
        /// <param name="type"></param>
        public static void Register(this Window win, string key,Type type)
        {
            WindowManager.Register(key, type);
        }

        /// <summary>
        /// 注册窗口/页面方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="page">要注册其他窗口/页的页面对象</param>
        /// <param name="key">被注册窗口/页的key</param>
        public static void Register<T>(this Page page, string key)
        {
            WindowManager.Register<T>(key);
        }
        /// <summary>
        /// 注册窗口/页面方法
        /// </summary>
        /// <param name="win"></param>
        /// <param name="key"></param>
        /// <param name="type"></param>
        public static void Register(this Page page, string key, Type type)
        {
            WindowManager.Register(key, type);
        }
    }
}
